import 'package:json_annotation/json_annotation.dart';

part 'common_page_resp_model.g.dart';

@JsonSerializable(genericArgumentFactories: true)
class CommonPageRespModel<T> {
  final List<T>? list;
  final int total, pageNum, pageSize, totalPage;

  CommonPageRespModel({
    this.list,
    this.total = 0,
    this.pageNum = 0,
    this.pageSize = 0,
    this.totalPage = 0,
  });

  factory CommonPageRespModel.fromJson(
    Map<String, dynamic> json,
    T Function(dynamic json) fromJsonT,
  ) =>
      _$CommonPageRespModelFromJson(json, fromJsonT);

  Map<String, dynamic> toJson(Object? Function(T value) toJsonT) =>
      _$CommonPageRespModelToJson(this, toJsonT);
}
